﻿@using MvcContrib
@using MvcContrib.UI.Grid
@using MvcContrib.UI.Grid.ActionSyntax
@model IEnumerable<BO.Product>
@{
    ViewBag.Title = "Products";
}
<script src="~/Scripts/ims.js" type="text/javascript"></script>
<h2>
    List of Products:</h2>
@{
    Html.Grid(Model).Columns(
            column =>
            {
                column.For(c => c.Id).Attributes(x => new Hash(style => "width:50px"));
                column.For(c => c.Name).Attributes(x => new Hash(style => "width:200px"));
                column.For(c => c.Description).Attributes(x => new Hash(style => "width:200px"));
                column.For(c => c.CategoryId).Attributes(x => new Hash(style => "width:20px"));
                column.For(c => c.Price).Attributes(x => new Hash(style => "width:50px"));
                column.Custom(@<div>
                    <a href="" onclick="onEdit(@item.ProductId)">edit</a></div>).Named("");
                column.Custom(@<div>
                    <a href="" onclick="onDelete(@item.ProductId)">delete</a></div>).Named("");
            }

        ).Render();
}
<br />
<h3>
    <a href="/Home/Edit">Create Product</a></h3>